package com.yanqu.road.server.cmd.monopolymarket.res;

import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.monopolymarket.MonopolyMarketModule;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @Description
 * @Author cwq
 * @Data 2021/9/3 18:38
 */
@Cmd(code = GameProtocol.S_MONOPOLY_MARKET_NORMAL_SETTLEMENT_NOTIFY_FROM_CROSS, desc = "资源争夺战 通知玩家据点被正常结算了")
public class MonopolyMarketResGrabNormalSettlementNotifyFromCrossCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        GamePlayer player = GamePlayerMgr.getOnlinePlayer(packet.getPlayerId());

        if(player != null){
            MonopolyMarketModule marketModule = player.getModule(MonopolyMarketModule.class);
            if(marketModule.inSystemId >= 0){
                // 去跨服领取奖励
                player.sendPacket(YanQuMessageUtils.buildMessage(CrossProtocol.C_CROSS_MONOPOLY_MARKET_RES_GRAB_RECEIVE_REWARD));
            }
        }
    }
}

